import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginVue from 'eslint-plugin-vue'

export default [
  { files: ['**/*.{js,mjs,cjs,ts,vue}'] },
  { languageOptions: { globals: globals.browser } },
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  ...pluginVue.configs['flat/essential'],
  {
    files: ['**/*.{js,mjs,cjs,ts,vue}'],
    languageOptions: { parserOptions: { parser: tseslint.parser } },
    rules: {
      // 完全禁用 @typescript-eslint/ban-ts-comment 规则
      '@typescript-eslint/ban-ts-comment': 'off',
      'no-var': 'off',
      //全局配置忽略prefer-const报错
      'no-redeclare': 'off',
      'no-import-assign': 'off',
      'prefer-const': 'off',
      //全局忽略template标签的报错
      'vue/multi-word-component-names': 'off',
      //忽略递归时在文件内部调用自己export自己的报错
      'vue/no-reserved-component-names': 'off',
      //忽略某些变量未被使用的错误
      'vue/no-unused-vars': 'off',
      //禁用 vue/valid-attribute-name 规则
      'vue/valid-attribute-name': 'off',
      'vue/prefer-import-from-vue': 'off', // 禁用 vue/prefer-import-from-vue 规则
    },
  },
]
